// 引入我们需要的环境地址 
import {developmentUrl} from "../config/env";
// 引入axios的对象
import request from "../config/axios";
// 调用商品列表 /shop/category/list?
export const CommodityClassificationlist = (data)=>request(
    {
        url:`${developmentUrl}/shop/category/list`,//请求的地址
        method:"GET",
        data
    }
)
export const addCategory=(data)=>request({
  url:`${developmentUrl}/shop/category?name=${data.name}&icon=$&id=&sort=${data.sort}&descript=${data.descript}&pid=${data.pid}`,
  method:"POSt"
})
export const removeCategory=(data)=>request({
  url:`${developmentUrl}/shop/category?id=${data.id}`,
  method:"DELETE"
})
export const changeHomePageShow=(data)=>request({
  url:`${developmentUrl}/shop/category/changeShowIndex/${data.id}/${data.showIndex}`,
  method:"POST"
})
export const bannerManageList=(data)=>request({
  url:`${developmentUrl}/shop/category/getBanners/${data.id}`,
  method:"GET"
})
export const deleteBanner=(data)=>request({
  url:`${developmentUrl}/shop/category/removeBanner/${data.categoryId}/${data.BannerId}`,
  method:"DELETE"
})
export const attributeManageList=(data)=>request({
  url:`${developmentUrl}/shop/category/getAttrKeys/${data.categoryId}`,
  method:"GET"
})
export const attributeAdd=(data)=>request({
  url:`${developmentUrl}/shop/goods/attr/key?attrName=${data.attrName}&idCategory=${data.idCategory}`,
  method:"POST"
})
export const attributeDelete=(data)=>request({
  url:`${developmentUrl}//shop/goods/attr/key?id=${data.id}`,
  method:"DELETE"
})
export const attributeNameEdit=(data)=>request({
  url:`${developmentUrl}/shop/goods/attr/key/updateAttrName?id=${data.id}&attrName=${data.attrName}`,
  method:"POST"
})
export const attributeValueList=(data)=>request({
  url:`${developmentUrl}/shop/attr/val/getAttrVals?idAttrKey=${data.idArrrKey}`,
  method:"GET"
})
export const attributeValueAdd=(data)=>request({
  url:`http://localhost:9528/dev-api/shop/attr/val?attrVal=${data.attrVal}&idAttrKey=${data.idAttrKey}`,
  method:"POST"
})
export const attributeValueEdit=(data)=>request({
  url:`${developmentUrl}/shop/attr/val/updateAttrVal?id=${data.id}&attrVal=${data.attrVal}`,
  method:"POST"
})
export const attributeValueRemove=(data)=>request({
  url:`http://localhost:9528/dev-api/shop/attr/val?id=${data.id}`,
  method:"DELETE"
})


// /article/list?page=1&limit=20
export const Ariclelist = (data) => request({
    url: `${developmentUrl}/article/list?page=1&limit=20`,
    method: "GET",
    data
})
// /article/list?page=1&limit=20
// page=1&limit=20&mobile=111&nickName=22222&startRegDate=2022-09-05&endRegDate=2022-09-16&startLastLoginTime=2022-09-18&endLastLoginTime=2022-10-12
// &mobile=${data.phone_number}
    // &nickName=${data.nick_Name}
    // &startRegDate=${data.startRegDate}
    // &endRegDate=${data.endRegDate}
    // &startLastLoginTime=${data.startLastLoginTime}
    // &endLastLoginTime=${data.endLastLoginTime}
export const CommodityManagementlist = (data) => request({
    url: `${developmentUrl}/shop/user/list`,
    method: "GET",
    data 
})
  export function getList (params) {
    return request({
      url: `${developmentUrl}/article/list`,
      method: 'get',
      params
    })
  }

  //删除 http://localhost:9528/dev-api/article?id=6
  export const remove= (data)=> request({
      url: `${developmentUrl}/article?id=${data.id}`,
      method: 'delete',
    })

    